package com.lovo.roomProject.system.dao.impl;

import com.lovo.roomProject.dao.BaseDAO;
import com.lovo.roomProject.pojo.ManageDO;
import com.lovo.roomProject.system.dao.UserDAO;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class UserDAOImpl extends BaseDAO implements UserDAO {
    @Override
    public List listUser() {
        this.getConnection();
        String sql="select * FROM t_manage";
        List list = new ArrayList();
        try {
            statement=con.prepareStatement(sql);
            rs=statement.executeQuery();
            while (rs.next()){
                ManageDO manageDO=new ManageDO();
                manageDO.setId(rs.getInt("m_id"));
                manageDO.setUser(rs.getString("m_user"));
                manageDO.setPwd(rs.getString("m_pwd"));
                manageDO.setName(rs.getString("m_name"));
                manageDO.setLeve(rs.getString("m_leve"));
                list.add(manageDO);
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }finally {
            close(con,statement,rs);
        }


        return list;
    }
}
